package cn.gson.crm.model.pojos;

import javax.persistence.*;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Objects;

@Entity
public class Invoice {
    private long lnId;
    private String lnNumber;
    private String lnAddress;
    private DeliveryPlan deliveryPlan;
    private Timestamp lnTime;
    private Customer customerByCustomerId;
    private Order order;
    private String ecrState;
    private Employee employee;
    private Long ereApprover;
    private Employee employee2;
    private String lnDesc;
    private String lnMoney;
    private String lnState;
    private String lnTuihanfou;
    private String wuliugongsi;
    @Basic
    @Column(name = "WULIUGONGSI")
    public String getWuliugongsi() {
        return wuliugongsi;
    }

    public void setWuliugongsi(String wuliugongsi) {
        this.wuliugongsi = wuliugongsi;
    }

    @Basic
    @Column(name = "LN_TUIHUANFOU", nullable = true, length = 200)
    public String getLnTuihanfou() {
        return lnTuihanfou;
    }

    public void setLnTuihanfou(String lnTuihanfou) {
        this.lnTuihanfou = lnTuihanfou;
    }

    @OneToOne
    @JoinColumn(name="ORDER_ID")
    public Order getOrder() {
        return order;
    }

    public void setOrder(Order order) {
        this.order = order;
    }
    @OneToOne
    @JoinColumn(name="PLAN_ID")
    public DeliveryPlan getDeliveryPlan() {
        return deliveryPlan;
    }

    public void setDeliveryPlan(DeliveryPlan deliveryPlan) {
        this.deliveryPlan = deliveryPlan;
    }

    @ManyToOne//可选属性optional=false,表示author不能为空。删除文章，不影响用户
    @JoinColumn(name = "ere_approver",insertable = false,updatable = false)//设置在article表中的关联字段(外键)
    public Employee getEmployee2() {
        return employee2;
    }

    public void setEmployee2(Employee employee2) {
        this.employee2 = employee2;
    }
    @Basic
    @Column(name = "ere_approver", nullable = true, length = 200)
    public Long getEreApprover() {
        return ereApprover;
    }

    public void setEreApprover(Long ereApprover) {
        this.ereApprover = ereApprover;
    }

    @ManyToOne//可选属性optional=false,表示author不能为空。删除文章，不影响用户
    @JoinColumn(name = "yg_id")//设置在article表中的关联字段(外键)
    public Employee getEmployee() {
        return employee;
    }

    public void setEmployee(Employee employee) {
        this.employee = employee;
    }

    @ManyToOne
    @JoinColumn(name = "customer_id", referencedColumnName = "customer_id")
    public Customer getCustomerByCustomerId() {
        return customerByCustomerId;
    }

    public void setCustomerByCustomerId(Customer customerByCustomerId) {
        this.customerByCustomerId = customerByCustomerId;
    }
    @Id
    @Column(name = "LN_ID", nullable = false, precision = 0)
    @GeneratedValue(generator  =  "seq",strategy  =  GenerationType.SEQUENCE)
    //定义一个序列生成器
    @SequenceGenerator(name  =  "seq",sequenceName  =  "crm",
            initialValue  =  1,allocationSize  =  1)
    public long getLnId() {
        return lnId;
    }

    public void setLnId(long lnId) {
        this.lnId = lnId;
    }

    @Basic
    @Column(name = "LN_NUMBER", nullable = true, length = 200)
    public String getLnNumber() {
        return lnNumber;
    }

    public void setLnNumber(String lnNumber) {
        this.lnNumber = lnNumber;
    }


    @Basic
    @Column(name = "LN_ADDRESS", nullable = true, length = 255)
    public String getLnAddress() {
        return lnAddress;
    }

    public void setLnAddress(String lnAddress) {
        this.lnAddress = lnAddress;
    }


    @Basic
    @Column(name = "LN_TIME", nullable = true)
    public Timestamp getLnTime() {
        return lnTime;
    }

    public void setLnTime(Timestamp lnTime) {
        this.lnTime = lnTime;
    }


    @Basic
    @Column(name = "ECR_STATE", nullable = true, length = 255)
    public String getEcrState() {
        return ecrState;
    }

    public void setEcrState(String ecrState) {
        this.ecrState = ecrState;
    }


    @Basic
    @Column(name = "LN_DESC", nullable = true, length = 255)
    public String getLnDesc() {
        return lnDesc;
    }

    public void setLnDesc(String lnDesc) {
        this.lnDesc = lnDesc;
    }

    @Basic
    @Column(name = "LN_MONEY", nullable = true, length = 255)
    public String getLnMoney() {
        return lnMoney;
    }

    public void setLnMoney(String lnMoney) {
        this.lnMoney = lnMoney;
    }

    @Basic
    @Column(name = "LN_STATE", nullable = true, length = 255)
    public String getLnState() {
        return lnState;
    }

    public void setLnState(String lnState) {
        this.lnState = lnState;
    }
}
